<?php 
/**
 * This file is part of DomFg.
 * 
 * DomFg is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * DomFg is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with DomFg.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * @link http://inditel.ee/
 * @copyright 2007-2009 Inditel Meedia OÜ
 * @author Oliver Leisalu <oliver@inditel.ee>
 */

class DomFgImageGrid extends DomFgGrid {
	
	protected $ordering = false;
	
	public function ordering( $value ) {
		$this->ordering = (bool)$value;
	}
	
	public static function parsePost( $name, &$value ) {
		$value['order'] = explode(';',(string)$value['order']);
		array_pop($value['order']);
		$value['order'] = array_flip($value['order']);
		return $value;
	}
	
	public function render() {
		$renderer = $this->getRenderer();
		$renderer->assign('grid', $this );
		$renderer->assign('columns', $this->columns );
		$renderer->assign('nrOfColumns', count($this->fields) );
		$renderer->assign('images', $this->getData() );
		$renderer->assign('headerFields', $this->getHeaderFields() );
		$renderer->assign('fields', $this->fields );
		$renderer->assign('pager', $this->getPager() );

		$renderer->assign('url', $this->link );
		
		return $renderer->fetch('imageGrid.html');
	}


}
?>